<?php
	$_items = $this->getReviewsCollection()->getItems();
	if(count($_items)>0):
?>
<div class="block block-reviews">
	<div class="block-title">
		<span class="view-all"><a href="<?php echo $this->getUrl('reviews/list')?>">view all</a></span>
		<strong>
			<span>Testimonials</span>
		</strong>
	</div>
	<div class="block-content">
		<ul class="reviews-list">
		<?php
			$i=1; foreach($_items as $_review):
		?>
			<li style="padding:5px 0;<?php if($i!=1): ?> border-top:1px solid #DCDCDC;<?php endif;?>">
				<div class="reviews-product-image"></div>
				<div class="reviews-list-detail">
				<dl>
					<?php
						$_product = $this->getProduct($_review->getEntityPkValue());
						$_helper = $this->helper('catalog/output');
					?>
					<dd>
						<div class="product-name">
							<a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($_product->getName(), null, true) ?>"><?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?></a>
						</div>
						<?php $_votes = $_review->getRatingVotes(); ?>
						<?php
							$percent = 0;
							foreach ($_votes as $_vote){
								$percent += $_vote->getPercent();
							}
							$percent = $percent/count($_votes);
						?>
						<div class="ratings2">
							<table cellspacing="0" cellpadding="0" border="0">
								<tr>
									<td>
										<div class="rating-box">
											<div style="background-position:0 -<?php echo round($percent*0.1)*17 ?>px;" class="rating"></div>
										</div>
									</td>
									<td>
										<span class="pr-rating pr-rounded"><?php echo sprintf("%.1f", $percent/2*0.1) ?></span>
									</td>
								</tr>
							</table>
						</div>
						<div class="reviews-name">
						<a href="<?php echo Mage::getUrl('review/product/view', array('id' => $_review->getId())); ?>"><?php echo $this->htmlEscape($_review->getTitle()) ?></a> (<?php echo $this->__('Review by <span>%s</span>', $this->htmlEscape($_review->getNickname())) ?>)
						</div>
						<?php echo nl2br($this->htmlEscape($_review->getDetail())) ?>						
					</dd>
				</dl>
				</div>
			</li>
		<?php
			$i++; endforeach;
		?>
		</ul>
	</div>
</div>
<?php endif; ?>